iT邦幫忙

2021 iThome 鐵人賽

DAY 10
0
自我挑戰組

菜鳥全端養成日誌系列 第 10

Azure - Day5 Azure Function

  • 分享至 

  • xImage
  •  

Hi~大家好,我今天想要分享的實作包括如下:

< Azure Function >

1. 在 Marketplace 搜尋 Function App , 點選Create
< Basics >

  • Function App name: test-life-api1-dev
  • Publish: Code
  • Runtime stack: Node.js
  • Version: 14 LTS
  • Region: Southeast Asia

< Hosting >

  • Storage account: testlifeapi1dev
  • Operation System: Windows
  • Plan type: Consumption ( Serverless )

< Monitoring >

  • Enable Application Insights: Yes
  • Application Insights: test-{$name}-api-dev

< Tags >

  • Service: test-life-api1-dev
  • Owner: life

2. 建立 Azure Function

  • Home > test-life-api1-dev > Functions > Create >
    • Development environment: Develop in portal
    • Select a template: 點選HTTP trigger
    • New Function: testHttpTrigger
    • Authorization Level: Function

3. Test function

  • Home > test-life-api1-dev > testHttpTrigger >
    • 點選 Code + Test > 點選 Test/Run > 點選 Run

< Input >

  • HTTP method: POST
  • Key: master (Host key)
  • Body:
    {
    "name": "Azure"
    }

< Output >

  • HTTP response code: 200 OK ( 驗證 Output )
  • HTTP response content: Hello, Azure. This HTTP triggered function executed successfully.

4. 透過 Browser 驗證 API

  • Home > test-life-api1-dev > testHttpTrigger >
    • 點選 Code + Test > 點選 Get function URL > Copy URL > 將 URL 貼入 Browser (驗證 Browser 輸出正常
      )

5. 設定 Azure Function 的 input binding
Home > test-life-api1-dev > testHttpTrigger > 點選 Integration > 點選 Add input
< Create Input >
Binding Type: Azure Cosmos DB
Cosmos DB account connection: New (Cosmos DB 帳戶連線: test-life-db1-dev)
Document parameter name: inputDocument ( default )
Database name: TestLifeDb
Collection Name: testLifeData


上一篇
Azure - Day4 Cosmos DB
下一篇
Azure - Day6 Azure Function
系列文
菜鳥全端養成日誌11
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言